import java.net.MalformedURLException;
import java.net.URL;

/**
 * @author Jimmy Zhan WORKSTATION
 * @date 2023/3/30 20:08
 * 说明：
 */

public class URLTest {
    public static void main(String[] args) {
        String str = "http://192.168.236.1:8080/examples/abcd.jpg?name=Tom";

        try {
            URL url = new URL(str);
            System.out.println(url.getProtocol());
            System.out.println(url.getHost());
            System.out.println(url.getPort());
            System.out.println(url.getPath());
            System.out.println(url.getFile());
            System.out.println(url.getQuery());


        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }

    }
}
